#pragma once
template <class Iterator, class Ref, class Ptr>
struct Reverse_Iterator
{
	typedef Reverse_Iterator<Iterator, Ref, Ptr> self;
	Iterator _cur;

	Reverse_Iterator(Iterator it)
		:_cur(it)
	{}

	Ref operator*()
	{
		Iterator tmp = _cur;
		--tmp;
		return *tmp;
	}

	self& operator++()
	{
		--_cur;
		return *this;
	}
	self operator++(int)
	{
		self tmp(*this);
		--_cur;
		return tmp;
	}

	self& operator--()
	{
		++_cur;
		return *this;
	}
	self operator--(int)
	{
		self tmp(*this);
		++_cur;
		return tmp;
	}
	Ptr operator->()
	{

		return &(operator*());
	}

	bool operator!=(const self& s)
	{
		return _cur != s._cur;
	}
};
